package com.itheima.d4_innerclass_anonymous;

public class test2 {
    public static void main(String[] args) {
        /**
         * 接口的匿名内部类
         */
        swimming s = new swimming() {
            @Override
            public void swim() {
                System.out.println("we can swim");
            }
        };
        go(s);

    }

    public static void go(swimming s){
        System.out.println("start");
        s.swim();
        System.out.println("end");
    }
}

/**
 * 当接口中只有一个方法时可以
 */
interface swimming{
    void swim();
}